programming:c:C functions for searching for filesWhat links here?
defined in io.h:

/*
 * Functions for searching for files. _findfirst returns -1 if no match
 * is found. Otherwise it returns a handle to be used in _findnext and
 * _findclose calls. _findnext also returns -1 if no match could be found,
 * and 0 if a match was found. Call _findclose when you are finished.
 */
int _findfirst (const char* szFilespec, struct _finddata_t* find);
int _findnext (int nHandle, struct _finddata_t* find);
int _findclose (int nHandle);


usage:

struct _finddata_t c_file;
long hFile;


if ( (hFile = _findfirst("*.c", &c_file)) == -1L ) { printf("No *.c files in current directory"); } else { do { printf("%s\n", c_file.name); } while ( _findnext(hFile, &c_file) == 0 ); _findclose(hFile); }


the _finddata_t struct:

/*
 * The following structure is filled in by _findfirst or _findnext when
 * they succeed in finding a match.
 */
struct _finddata_t
{
        unsigned    attrib;             /* Attributes, see constants above. */
        time_t      time_create;
        time_t      time_access;        /* always midnight local time */
        time_t      time_write;
        _fsize_t    size;
        char       name[FILENAME_MAX];  /* may include spaces. */
};
programming:c:C functions for searching for files
filename:programming:c:C functions for searching for files
filename:programming%3Ac%3AC%20functions%20for%20searching%20for%20files
last edit:January 07 2010 20:24:56 (5231 days ago)
ct = 1714942989.000000 = May 05 2024 17:03:09
ft = 1262913896.000000 = January 07 2010 20:24:56
dt = 452029093.000000